<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>sgp4oo: Fichero Fuente sgp4_math.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generado por Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="annotated.html"><span>Clases</span></a></li>
      <li class="current"><a href="files.html"><span>Archivos</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;de&nbsp;archivos</span></a></li>
      <li><a href="globals.html"><span>Miembros&nbsp;de&nbsp;los&nbsp;ficheros</span></a></li>
    </ul>
  </div>
<h1>sgp4_math.cpp</h1><a href="sgp4__math_8cpp.html">Ir a la documentación de este archivo.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="sgp4__math_8h.html">sgp4_math.h</a>&quot;</span>
<a name="l00028"></a>00028 
<a name="l00036"></a><a class="code" href="classsgp4__math.html#aea3e78c4a67943a23eabdbd4d0585c3e">00036</a>  <span class="keywordtype">double</span>  <a class="code" href="classsgp4__math.html#aea3e78c4a67943a23eabdbd4d0585c3e" title="this file contains extra routines needed for the main test program for sgp4.">sgp4_math::sgn</a>(<span class="keywordtype">double</span> x){
<a name="l00037"></a>00037      <span class="keywordflow">if</span> (x &lt; 0.0){
<a name="l00038"></a>00038           <span class="keywordflow">return</span> -1.0;
<a name="l00039"></a>00039       }<span class="keywordflow">else</span>{
<a name="l00040"></a>00040           <span class="keywordflow">return</span> 1.0;
<a name="l00041"></a>00041       }
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 }  <span class="comment">// end sgn</span>
<a name="l00044"></a>00044 
<a name="l00077"></a><a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e">00077</a>  <span class="keywordtype">double</span>  <a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e" title="this procedure finds the magnitude of a vector">sgp4_math::mag</a>(<span class="keywordtype">double</span> x[3]){
<a name="l00078"></a>00078      <span class="keywordflow">return</span> sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
<a name="l00079"></a>00079 }  <span class="comment">// end mag</span>
<a name="l00080"></a>00080 
<a name="l00113"></a><a class="code" href="classsgp4__math.html#a35d24a138a32d34caaf17e2cf023b947">00113</a>  <span class="keywordtype">void</span>    <a class="code" href="classsgp4__math.html#a35d24a138a32d34caaf17e2cf023b947" title="this procedure crosses two vectors.">sgp4_math::cross</a>(<span class="keywordtype">double</span> vec1[3], <span class="keywordtype">double</span> vec2[3], <span class="keywordtype">double</span> outvec[3]){
<a name="l00114"></a>00114      outvec[0]= vec1[1]*vec2[2] - vec1[2]*vec2[1];
<a name="l00115"></a>00115      outvec[1]= vec1[2]*vec2[0] - vec1[0]*vec2[2];
<a name="l00116"></a>00116      outvec[2]= vec1[0]*vec2[1] - vec1[1]*vec2[0];
<a name="l00117"></a>00117 }  <span class="comment">// end cross</span>
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 
<a name="l00154"></a><a class="code" href="classsgp4__math.html#ae74041d2049dee6fae0db1c6a7515643">00154</a>  <span class="keywordtype">double</span>  <a class="code" href="classsgp4__math.html#ae74041d2049dee6fae0db1c6a7515643" title="this function finds the dot product of two vectors..">sgp4_math::dot</a>(<span class="keywordtype">double</span> x[3], <span class="keywordtype">double</span> y[3]){
<a name="l00155"></a>00155      <span class="keywordflow">return</span> (x[0]*y[0] + x[1]*y[1] + x[2]*y[2]);
<a name="l00156"></a>00156 }  <span class="comment">// end dot</span>
<a name="l00157"></a>00157 
<a name="l00193"></a><a class="code" href="classsgp4__math.html#a33722da47f2bfa0849412316cddfabf5">00193</a>  <span class="keywordtype">double</span>  <a class="code" href="classsgp4__math.html#a33722da47f2bfa0849412316cddfabf5" title="this procedure calculates the angle between two vectors.">sgp4_math::angle</a>(<span class="keywordtype">double</span> vec1[3],<span class="keywordtype">double</span> vec2[3]){
<a name="l00194"></a>00194      <span class="keywordtype">double</span> small, undefined, magv1, magv2, temp;
<a name="l00195"></a>00195      small     = 0.00000001;
<a name="l00196"></a>00196      undefined = 999999.1;
<a name="l00197"></a>00197 
<a name="l00198"></a>00198      magv1 = <a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e" title="this procedure finds the magnitude of a vector">mag</a>(vec1);
<a name="l00199"></a>00199      magv2 = <a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e" title="this procedure finds the magnitude of a vector">mag</a>(vec2);
<a name="l00200"></a>00200 
<a name="l00201"></a>00201      <span class="keywordflow">if</span> (magv1*magv2 &gt; small*small){
<a name="l00202"></a>00202          temp= <a class="code" href="classsgp4__math.html#ae74041d2049dee6fae0db1c6a7515643" title="this function finds the dot product of two vectors..">dot</a>(vec1,vec2) / (magv1*magv2);
<a name="l00203"></a>00203          <span class="keywordflow">if</span> (fabs( temp ) &gt; 1.0)
<a name="l00204"></a>00204              temp= <a class="code" href="classsgp4__math.html#aea3e78c4a67943a23eabdbd4d0585c3e" title="this file contains extra routines needed for the main test program for sgp4.">sgn</a>(temp) * 1.0;
<a name="l00205"></a>00205          <span class="keywordflow">return</span> acos( temp );
<a name="l00206"></a>00206      }<span class="keywordflow">else</span>
<a name="l00207"></a>00207         <span class="keywordflow">return</span> undefined;
<a name="l00208"></a>00208 }  <span class="comment">// end angle</span>
<a name="l00209"></a>00209 
<a name="l00210"></a>00210 
<a name="l00243"></a><a class="code" href="classsgp4__math.html#a88f575cde2af14c3b7f8e3bb64053e49">00243</a> <span class="keywordtype">double</span>  <a class="code" href="classsgp4__math.html#a88f575cde2af14c3b7f8e3bb64053e49" title="this function evaluates the inverse hyperbolic sine function.">sgp4_math::asinh</a>(<span class="keywordtype">double</span> xval){
<a name="l00244"></a>00244      <span class="keywordflow">return</span> log( xval + sqrt( xval*xval + 1.0 ) );
<a name="l00245"></a>00245 }  <span class="comment">// end asinh</span>
<a name="l00246"></a>00246 
<a name="l00247"></a>00247 
<a name="l00296"></a><a class="code" href="classsgp4__math.html#a67021755c597c209e05704690f3324b2">00296</a>  <span class="keywordtype">void</span> <a class="code" href="classsgp4__math.html#a67021755c597c209e05704690f3324b2" title="this function solves keplers equation when the true anomaly is known.">sgp4_math::newtonnu</a>(<span class="keywordtype">double</span> ecc, <span class="keywordtype">double</span> nu,<span class="keywordtype">double</span>&amp; e0, <span class="keywordtype">double</span>&amp; m){
<a name="l00297"></a>00297        <span class="keywordtype">double</span> small, sine, cose;
<a name="l00298"></a>00298 
<a name="l00299"></a>00299      <span class="comment">// ---------------------  implementation   ---------------------</span>
<a name="l00300"></a>00300      e0= 999999.9;
<a name="l00301"></a>00301      m = 999999.9;
<a name="l00302"></a>00302      small = 0.00000001;
<a name="l00303"></a>00303 
<a name="l00304"></a>00304      <span class="comment">// --------------------------- circular ------------------------</span>
<a name="l00305"></a>00305      <span class="keywordflow">if</span> ( fabs( ecc ) &lt; small  ){
<a name="l00306"></a>00306          m = nu;
<a name="l00307"></a>00307          e0= nu;
<a name="l00308"></a>00308      }<span class="keywordflow">else</span>
<a name="l00309"></a>00309          <span class="comment">// ---------------------- elliptical -----------------------</span>
<a name="l00310"></a>00310          <span class="keywordflow">if</span> ( ecc &lt; 1.0-small  ){
<a name="l00311"></a>00311              sine= ( sqrt( 1.0 -ecc*ecc ) * sin(nu) ) / ( 1.0 +ecc*cos(nu) );
<a name="l00312"></a>00312              cose= ( ecc + cos(nu) ) / ( 1.0  + ecc*cos(nu) );
<a name="l00313"></a>00313              e0  = atan2( sine,cose );
<a name="l00314"></a>00314              m   = e0 - ecc*sin(e0);
<a name="l00315"></a>00315            }<span class="keywordflow">else</span>
<a name="l00316"></a>00316              <span class="comment">// -------------------- hyperbolic  --------------------</span>
<a name="l00317"></a>00317              <span class="keywordflow">if</span> ( ecc &gt; 1.0 + small  ){
<a name="l00318"></a>00318                  <span class="keywordflow">if</span> ((ecc &gt; 1.0 ) &amp;&amp; (fabs(nu)+0.00001 &lt; <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>-acos(1.0 /ecc))){
<a name="l00319"></a>00319                      sine= ( sqrt( ecc*ecc-1.0  ) * sin(nu) ) / ( 1.0  + ecc*cos(nu) );
<a name="l00320"></a>00320                      e0  = log( sine + sqrt( sine*sine + 1.0 ) );
<a name="l00321"></a>00321                      m   = ecc*sinh(e0) - e0;
<a name="l00322"></a>00322                    }
<a name="l00323"></a>00323               }<span class="keywordflow">else</span>{
<a name="l00324"></a>00324                  <span class="comment">// ----------------- parabolic ---------------------</span>
<a name="l00325"></a>00325                  <span class="keywordflow">if</span> ( fabs(nu) &lt; 168.0*<a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>/180.0  ){
<a name="l00326"></a>00326                      e0= tan( nu*0.5  );
<a name="l00327"></a>00327                      m = e0 + (e0*e0*e0)/3.0;
<a name="l00328"></a>00328                  }
<a name="l00329"></a>00329               }
<a name="l00330"></a>00330 
<a name="l00331"></a>00331      <span class="keywordflow">if</span> ( ecc &lt; 1.0  ){
<a name="l00332"></a>00332          m = fmod( m,2.0 *<a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a> );
<a name="l00333"></a>00333          <span class="keywordflow">if</span> ( m &lt; 0.0  )
<a name="l00334"></a>00334              m = m + 2.0 *<a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l00335"></a>00335          e0 = fmod( e0,2.0 *<a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a> );
<a name="l00336"></a>00336        }
<a name="l00337"></a>00337    }  <span class="comment">// end newtonnu</span>
<a name="l00338"></a>00338 
<a name="l00339"></a>00339 
<a name="l00431"></a><a class="code" href="classsgp4__math.html#aafe8e1a26df7d91fb20be252f263a58a">00431</a> <span class="keywordtype">void</span> <a class="code" href="classsgp4__math.html#aafe8e1a26df7d91fb20be252f263a58a" title="this function finds the classical orbital elements given the geocentric equatorial...">sgp4_math::rv2coe</a>(
<a name="l00432"></a>00432        <span class="keywordtype">double</span> r[3], <span class="keywordtype">double</span> v[3], <span class="keywordtype">double</span> mu,
<a name="l00433"></a>00433        <span class="keywordtype">double</span>&amp; p, <span class="keywordtype">double</span>&amp; a, <span class="keywordtype">double</span>&amp; ecc, <span class="keywordtype">double</span>&amp; incl, <span class="keywordtype">double</span>&amp; omega, <span class="keywordtype">double</span>&amp; argp,
<a name="l00434"></a>00434        <span class="keywordtype">double</span>&amp; nu, <span class="keywordtype">double</span>&amp; m, <span class="keywordtype">double</span>&amp; arglat, <span class="keywordtype">double</span>&amp; truelon, <span class="keywordtype">double</span>&amp; lonper
<a name="l00435"></a>00435      ){
<a name="l00436"></a>00436        <span class="keywordtype">double</span> undefined, small, hbar[3], nbar[3], magr, magv, magn, ebar[3], sme,
<a name="l00437"></a>00437               rdotv, infinite, temp, c1, hk, twopi, magh, halfpi, e;
<a name="l00438"></a>00438 
<a name="l00439"></a>00439        <span class="keywordtype">int</span> i;
<a name="l00440"></a>00440        <span class="keywordtype">char</span> typeorbit[3];
<a name="l00441"></a>00441 
<a name="l00442"></a>00442      twopi  = 2.0 * <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l00443"></a>00443      halfpi = 0.5 * <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l00444"></a>00444      small  = 0.00000001;
<a name="l00445"></a>00445      undefined = 999999.1;
<a name="l00446"></a>00446      infinite  = 999999.9;
<a name="l00447"></a>00447 
<a name="l00448"></a>00448      <span class="comment">// -------------------------  implementation   -----------------</span>
<a name="l00449"></a>00449      magr = <a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e" title="this procedure finds the magnitude of a vector">mag</a>( r );
<a name="l00450"></a>00450      magv = <a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e" title="this procedure finds the magnitude of a vector">mag</a>( v );
<a name="l00451"></a>00451 
<a name="l00452"></a>00452      <span class="comment">// ------------------  find h n and e vectors   ----------------</span>
<a name="l00453"></a>00453      <a class="code" href="classsgp4__math.html#a35d24a138a32d34caaf17e2cf023b947" title="this procedure crosses two vectors.">cross</a>( r,v, hbar );
<a name="l00454"></a>00454      magh = <a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e" title="this procedure finds the magnitude of a vector">mag</a>( hbar );
<a name="l00455"></a>00455      <span class="keywordflow">if</span> ( magh &gt; small ){
<a name="l00456"></a>00456          nbar[0]= -hbar[1];
<a name="l00457"></a>00457          nbar[1]=  hbar[0];
<a name="l00458"></a>00458          nbar[2]=   0.0;
<a name="l00459"></a>00459          magn = <a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e" title="this procedure finds the magnitude of a vector">mag</a>( nbar );
<a name="l00460"></a>00460          c1 = magv*magv - mu /magr;
<a name="l00461"></a>00461          rdotv = <a class="code" href="classsgp4__math.html#ae74041d2049dee6fae0db1c6a7515643" title="this function finds the dot product of two vectors..">dot</a>( r,v );
<a name="l00462"></a>00462          <span class="keywordflow">for</span> (i= 0; i &lt;= 2; i++)
<a name="l00463"></a>00463              ebar[i]= (c1*r[i] - rdotv*v[i])/mu;
<a name="l00464"></a>00464          ecc = <a class="code" href="classsgp4__math.html#a66bce8799e00fe4c922b9f0434b6128e" title="this procedure finds the magnitude of a vector">mag</a>( ebar );
<a name="l00465"></a>00465 
<a name="l00466"></a>00466          <span class="comment">// ------------  find a e and semi-latus rectum   ----------</span>
<a name="l00467"></a>00467          sme= ( magv*magv*0.5  ) - ( mu /magr );
<a name="l00468"></a>00468          <span class="keywordflow">if</span> ( fabs( sme ) &gt; small )
<a name="l00469"></a>00469              a= -mu  / (2.0 *sme);
<a name="l00470"></a>00470            <span class="keywordflow">else</span>
<a name="l00471"></a>00471              a= infinite;
<a name="l00472"></a>00472          p = magh*magh/mu;
<a name="l00473"></a>00473 
<a name="l00474"></a>00474          <span class="comment">// -----------------  find inclination   -------------------</span>
<a name="l00475"></a>00475          hk= hbar[2]/magh;
<a name="l00476"></a>00476          incl= acos( hk );
<a name="l00477"></a>00477 
<a name="l00478"></a>00478          <span class="comment">// --------  determine type of orbit for later use  --------</span>
<a name="l00479"></a>00479          <span class="comment">// ------ elliptical, parabolic, hyperbolic inclined -------</span>
<a name="l00480"></a>00480          strcpy(typeorbit,<span class="stringliteral">&quot;ei&quot;</span>);
<a name="l00481"></a>00481          <span class="keywordflow">if</span> ( ecc &lt; small ){
<a name="l00482"></a>00482              <span class="comment">// ----------------  circular equatorial ---------------</span>
<a name="l00483"></a>00483              <span class="keywordflow">if</span>  ((incl&lt;small) | (fabs(incl-<a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>)&lt;small))
<a name="l00484"></a>00484                  strcpy(typeorbit,<span class="stringliteral">&quot;ce&quot;</span>);
<a name="l00485"></a>00485                <span class="keywordflow">else</span>
<a name="l00486"></a>00486                  <span class="comment">// --------------  circular inclined ---------------</span>
<a name="l00487"></a>00487                  strcpy(typeorbit,<span class="stringliteral">&quot;ci&quot;</span>);
<a name="l00488"></a>00488            }<span class="keywordflow">else</span>{
<a name="l00489"></a>00489              <span class="comment">// - elliptical, parabolic, hyperbolic equatorial --</span>
<a name="l00490"></a>00490              <span class="keywordflow">if</span>  ((incl&lt;small) | (fabs(incl-<a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>)&lt;small))
<a name="l00491"></a>00491                  strcpy(typeorbit,<span class="stringliteral">&quot;ee&quot;</span>);
<a name="l00492"></a>00492            }
<a name="l00493"></a>00493 
<a name="l00494"></a>00494          <span class="comment">// ----------  find longitude of ascending node ------------</span>
<a name="l00495"></a>00495          <span class="keywordflow">if</span> ( magn &gt; small ){
<a name="l00496"></a>00496              temp= nbar[0] / magn;
<a name="l00497"></a>00497              <span class="keywordflow">if</span> ( fabs(temp) &gt; 1.0  )
<a name="l00498"></a>00498                  temp= <a class="code" href="classsgp4__math.html#aea3e78c4a67943a23eabdbd4d0585c3e" title="this file contains extra routines needed for the main test program for sgp4.">sgn</a>(temp);
<a name="l00499"></a>00499              omega= acos( temp );
<a name="l00500"></a>00500              <span class="keywordflow">if</span> ( nbar[1] &lt; 0.0  )
<a name="l00501"></a>00501                  omega= twopi - omega;
<a name="l00502"></a>00502            }<span class="keywordflow">else</span>
<a name="l00503"></a>00503              omega= undefined;
<a name="l00504"></a>00504 
<a name="l00505"></a>00505          <span class="comment">// ---------------- find argument of perigee ---------------</span>
<a name="l00506"></a>00506          <span class="keywordflow">if</span> ( strcmp(typeorbit,<span class="stringliteral">&quot;ei&quot;</span>) == 0 ){
<a name="l00507"></a>00507              argp = <a class="code" href="classsgp4__math.html#a33722da47f2bfa0849412316cddfabf5" title="this procedure calculates the angle between two vectors.">angle</a>( nbar,ebar);
<a name="l00508"></a>00508              <span class="keywordflow">if</span> ( ebar[2] &lt; 0.0  )
<a name="l00509"></a>00509                  argp= twopi - argp;
<a name="l00510"></a>00510            }<span class="keywordflow">else</span>
<a name="l00511"></a>00511              argp= undefined;
<a name="l00512"></a>00512 
<a name="l00513"></a>00513          <span class="comment">// ------------  find true anomaly at epoch    -------------</span>
<a name="l00514"></a>00514          <span class="keywordflow">if</span> ( typeorbit[0] == <span class="charliteral">&#39;e&#39;</span> ){
<a name="l00515"></a>00515              nu =  <a class="code" href="classsgp4__math.html#a33722da47f2bfa0849412316cddfabf5" title="this procedure calculates the angle between two vectors.">angle</a>( ebar,r);
<a name="l00516"></a>00516              <span class="keywordflow">if</span> ( rdotv &lt; 0.0  )
<a name="l00517"></a>00517                  nu= twopi - nu;
<a name="l00518"></a>00518            }<span class="keywordflow">else</span>
<a name="l00519"></a>00519              nu= undefined;
<a name="l00520"></a>00520 
<a name="l00521"></a>00521          <span class="comment">// ----  find argument of latitude - circular inclined -----</span>
<a name="l00522"></a>00522          <span class="keywordflow">if</span> ( strcmp(typeorbit,<span class="stringliteral">&quot;ci&quot;</span>) == 0 ){
<a name="l00523"></a>00523              arglat = <a class="code" href="classsgp4__math.html#a33722da47f2bfa0849412316cddfabf5" title="this procedure calculates the angle between two vectors.">angle</a>( nbar,r );
<a name="l00524"></a>00524              <span class="keywordflow">if</span> ( r[2] &lt; 0.0  )
<a name="l00525"></a>00525                  arglat= twopi - arglat;
<a name="l00526"></a>00526              m = arglat;
<a name="l00527"></a>00527            }
<a name="l00528"></a>00528            <span class="keywordflow">else</span>
<a name="l00529"></a>00529              arglat= undefined;
<a name="l00530"></a>00530 
<a name="l00531"></a>00531          <span class="comment">// -- find longitude of perigee - elliptical equatorial ----</span>
<a name="l00532"></a>00532          <span class="keywordflow">if</span>  (( ecc&gt;small ) &amp;&amp; (strcmp(typeorbit,<span class="stringliteral">&quot;ee&quot;</span>) == 0))
<a name="l00533"></a>00533            {
<a name="l00534"></a>00534              temp= ebar[0]/ecc;
<a name="l00535"></a>00535              <span class="keywordflow">if</span> ( fabs(temp) &gt; 1.0  )
<a name="l00536"></a>00536                  temp= <a class="code" href="classsgp4__math.html#aea3e78c4a67943a23eabdbd4d0585c3e" title="this file contains extra routines needed for the main test program for sgp4.">sgn</a>(temp);
<a name="l00537"></a>00537              lonper= acos( temp );
<a name="l00538"></a>00538              <span class="keywordflow">if</span> ( ebar[1] &lt; 0.0  )
<a name="l00539"></a>00539                  lonper= twopi - lonper;
<a name="l00540"></a>00540              <span class="keywordflow">if</span> ( incl &gt; halfpi )
<a name="l00541"></a>00541                  lonper= twopi - lonper;
<a name="l00542"></a>00542            }
<a name="l00543"></a>00543            <span class="keywordflow">else</span>
<a name="l00544"></a>00544              lonper= undefined;
<a name="l00545"></a>00545 
<a name="l00546"></a>00546          <span class="comment">// -------- find true longitude - circular equatorial ------</span>
<a name="l00547"></a>00547          <span class="keywordflow">if</span>  (( magr&gt;small ) &amp;&amp; ( strcmp(typeorbit,<span class="stringliteral">&quot;ce&quot;</span>) == 0 ))
<a name="l00548"></a>00548            {
<a name="l00549"></a>00549              temp= r[0]/magr;
<a name="l00550"></a>00550              <span class="keywordflow">if</span> ( fabs(temp) &gt; 1.0  )
<a name="l00551"></a>00551                  temp= <a class="code" href="classsgp4__math.html#aea3e78c4a67943a23eabdbd4d0585c3e" title="this file contains extra routines needed for the main test program for sgp4.">sgn</a>(temp);
<a name="l00552"></a>00552              truelon= acos( temp );
<a name="l00553"></a>00553              <span class="keywordflow">if</span> ( r[1] &lt; 0.0  )
<a name="l00554"></a>00554                  truelon= twopi - truelon;
<a name="l00555"></a>00555              <span class="keywordflow">if</span> ( incl &gt; halfpi )
<a name="l00556"></a>00556                  truelon= twopi - truelon;
<a name="l00557"></a>00557              m = truelon;
<a name="l00558"></a>00558            }
<a name="l00559"></a>00559            <span class="keywordflow">else</span>
<a name="l00560"></a>00560              truelon= undefined;
<a name="l00561"></a>00561 
<a name="l00562"></a>00562          <span class="comment">// ------------ find mean anomaly for all orbits -----------</span>
<a name="l00563"></a>00563          <span class="keywordflow">if</span> ( typeorbit[0] == <span class="charliteral">&#39;e&#39;</span> )
<a name="l00564"></a>00564              <a class="code" href="classsgp4__math.html#a67021755c597c209e05704690f3324b2" title="this function solves keplers equation when the true anomaly is known.">newtonnu</a>(ecc,nu,  e, m);
<a name="l00565"></a>00565      }
<a name="l00566"></a>00566       <span class="keywordflow">else</span>
<a name="l00567"></a>00567      {
<a name="l00568"></a>00568         p    = undefined;
<a name="l00569"></a>00569         a    = undefined;
<a name="l00570"></a>00570         ecc  = undefined;
<a name="l00571"></a>00571         incl = undefined;
<a name="l00572"></a>00572         omega= undefined;
<a name="l00573"></a>00573         argp = undefined;
<a name="l00574"></a>00574         nu   = undefined;
<a name="l00575"></a>00575         m    = undefined;
<a name="l00576"></a>00576         arglat = undefined;
<a name="l00577"></a>00577         truelon= undefined;
<a name="l00578"></a>00578         lonper = undefined;
<a name="l00579"></a>00579      }
<a name="l00580"></a>00580    }  <span class="comment">// end rv2coe</span>
<a name="l00581"></a>00581 
<a name="l00582"></a>00582 
<a name="l00583"></a>00583 
<a name="l00584"></a>00584 
<a name="l00585"></a>00585 
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generado el Tue May 22 09:43:43 2012 para sgp4oo por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
